<template>
	<view class="padding-lg text-df">
		<view class="flex-row">
			<view class="flex-column-bc" style="">
				<uni-icons type="smallcircle-filled" color="#3c9cff" size="14"></uni-icons>
				<view v-if="current>0" style="border-right: 1px solid #3c9cff; height: 100%;"></view>
			</view>
			<view class="margin-left-sm">
				<view> {{step_1.createTime}}</view>
				<view class="margin-top-lg flex-row">
					<view style="width: 150rpx;">地址：</view>
					<view> {{step_1.firstAddress}}</view>
				</view>
				<view class="margin-top-sm flex-row">
					<view style="width: 150rpx;">详细地址：</view>
					<view> {{step_1.fullAddress}}</view>
				</view>
				<view class="margin-top-sm flex-row">
					<view style="width: 150rpx;">负责辖区：</view>
					<view> {{step_1.secondAddress}}</view>
				</view>
				<view class="margin-top-sm flex-row">
					<view>意见内容：</view>
					<view style="width: 65%;height:100px;overflow-y: scroll;" @click="getDetail(step_1.content)"> {{step_1.content}}</view>
				</view>
				<view class="margin-tb-sm">图片描述：</view>
				<view style="display: flex; flex-wrap: wrap;">
					<image v-for="(item,index) in step_1.imageList" :key="index" :src="item.url"
						style="width: 150rpx; height: 150rpx;" mode="aspectFill" class="margin-right-sm margin-top-sm">
					</image>
				</view>
			</view>
		</view>


		<view class="flex-row margin-top-xl" v-if="current>=1">
			<view class="flex-column-bc" style="">
				<uni-icons type="smallcircle-filled" color="#3c9cff" size="14"></uni-icons>
				<view v-if="current>1" style="border-right: 1px solid #3c9cff; height: 100%;"></view>
			</view>
			<view class="margin-left-sm">
				<view>{{step_2.createTime}}</view>
				<view class="margin-top-lg flex-row">
					<view style="width: 150rpx;">处理人：</view>
					<view> {{step_2.name}}{{step_2.phone}}</view>
				</view>
				<view class="margin-top-sm flex-row">
					<view style="width: 150rpx;">处理结果：</view>
					<view style="width: 65%;height:100px;overflow-y: scroll;"> {{step_2.content}}</view>
				</view>
				<view class="margin-top-sm flex-row">
					<view style="width: 150rpx;">处理状态：</view>
					<view> {{status}}</view>
				</view>
				<view class="margin-tb-sm">图片描述：</view>
				<view style="display: flex; flex-wrap: wrap;">
					<image v-for="(item,index) in step_2.imageList" :key="index" :src="item.url"
						style="width: 150rpx; height: 150rpx;" mode="aspectFill" class="margin-right-sm margin-top-sm">
					</image>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import { getResultsByAdviseId } from '../../api/advise_api.js'
	export default {
		data() {
			return {
				current: 1,
				step_1: {},
                status:'',
				step_2: {}
			}
		},
		onLoad(options){
			console.log(options.id)
			getResultsByAdviseId(options.id).then(res =>{
				this.step_1 = res.data.advise
				this.step_2 = { ...res.data.resultsList[0] }
				this.status = res.data.advise.stateCode == 3 ? '待审核' : '已完成'
			})	
		},
		methods: {
			getDetail(info) {
				uni.showModal({
				    content: info,//模板中提示的内容
				    confirmText:'复制内容',
				    success:(res) => {//点击复制内容的后调函数
						if(res.confirm) {
							let result
							// #ifndef H5
							//uni.setClipboardData方法就是讲内容复制到粘贴板
							uni.setClipboardData({
								data: info,//要被复制的内容
								success:() => {//复制成功的回调函数
									uni.showToast({//提示
										title:'复制成功' 
									})
								}
							});
							// #endif
							
							 // #ifdef H5 
								let textarea = document.createElement("textarea")
								textarea.value = info
								textarea.readOnly = "readOnly"
								document.body.appendChild(textarea)
								textarea.select() // 选中文本内容
								textarea.setSelectionRange(0, info.length) 
								uni.showToast({//提示
									title:'复制成功' 
								})
								result = document.execCommand("copy") 
								textarea.remove()    
							// #endif
						} else {
							console.log('取消')
						}
				    }
				});
			}
,
			getDate(){
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}
</style>